﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

public partial class ListSearch : System.Web.UI.Page
{
    //检索书籍目录
    protected void Page_Load(object sender, EventArgs e)
    {
        
        if (Request.Form["siteid"] != null&&Request.Form["bookname"]!=null)
        {
            Response.Clear();
            //登录
            if (Page.User.Identity.Name == "")
                Response.Write("尚未登录");
            else
            {
                //用户
                string sUserName = Page.User.Identity.Name;
                string sSiteID = Request.Form["siteid"].ToString();
                string sBookName = Request.Form["bookname"].ToString();
                //获取指定 站点的 信息
                SiteInfo siteinfo=WebMake.getSiteInfo(sSiteID);

                //根据信息检索，并取得格式化好的文本。
                Response.Write(WebMake.getListSearch(siteinfo, sBookName,true));
                //输出。
            }
            Response.End();
        }//end of check

        else if (Request.Form["lb"] != null&&Request.Form["bookid"]!=null&&Request.Form["lists"]!=null)
        {
            if (Request.Form["lb"].ToString() == "addlist")
            {
                Response.Clear();
                
                if (Page.User.Identity.Name == "")
                    Response.Write("尚未登录");
                else
                {
                    string sBookID = Request.Form["bookid"].ToString();
                    string sSiteList=Request.Form["lists"].ToString();
                    string sUserName = Page.User.Identity.Name;
                    string sReturnStr=BookManger.addBookList(sBookID, sSiteList, sUserName);
                    WebMake.buildBookPage(sBookID, -1);
                    Response.Write(sReturnStr);
                }

                Response.End();
            }
        }

        
    }
}
